const tags = {
    name: "schedules",
    description: "排片管理模块",
};

const schemas = {
    // 获取当前页面的条件的数据结构
    ArrayOfSchedulesRetuen: {
        properties: {
            total: {
                type: "number",
                description: "总数",
            },
            maxPage: {
                type: "number",
                description: "总页数",

            },
            rows: {
                type: "array",
                description: "排片当页数据",
                items: {
                    $ref: "#/components/schemas/rowsReturn",
                }
            }
        },

    },
    rowsReturn: {
        properties: {
            _id: {
                type: "number",
                description: "排片id",
            },
            cinemasId: {
                type: "Object",
                description: "影院整条数据",

            },
            movieId: {
                type: "Object",
                description: "电影整条数据",
            },
            price: {
                type: "string",
                description: "价格",
            },
            showTime: {
                type: "string",
                description: "放映时间",
            },
            theaterId: {
                type: "Object",
                description: "放映厅整条数据",
            },
        },

    },
    movieRetuen: {
        properties: {
            _id: {
                type: "string",
                description: "导演",
            },
            area: {
                type: "string",
                description: "国家",

            },
            count: {
                type: "string",
                description: "票房",
            },

        },
    },

    theaterRetuen: {
        properties: {
            _id: {
                type: "string",
                description: "放映厅id",
            },
            cinemasId: {
                type: "string",
                description: "影院id",
            },
            theatersName: {
                type: "string",
                description: "放映厅名字",
            },
            theatersStatus: {
                type: "Boolean",
                description: "true为开放，false为未开放",
            },
        }
    },
    addSchedules: {
        properties: {
            movieId: {
                type: "string",
                description: "电影id",
            },
            cinemasId: {
                type: "string",
                description: "影院id",

            },
            theaterId: {
                type: "string",
                description: "放映厅",
            },
            showTime: {
                type: "string",
                description: "放映时间",
            },
            price: {
                type: "number",
                description: "价格",
            },
        },
    },
    addReturn: {
        properties: {
            status: {
                type: "Boolean",
                description: "true为成功，false为失败",
            },

        },
    },
    getsortmoviesRetuen: {
        properties: {
            status: {
                type: "Boolean",
                description: "true为成功，false为失败",
            },

        },
    },
    getSeatingsReturn: {
        properties: {
            status: {
                type: "number",
                description: "0为未购买，1为已购买",
            },
            _id: {
                type: "string",
                description: "选座id",
            },
            seatId: {
                type: "Array",
                description: "座位的完整数据",
            },
            schedulesId: {
                type: "Array",
                description: "排片的完整数据",
            },

        },
    }

};

const paths = {
    "/schedules/get": {
        get: {
            tags: ["schedules"],
            summary: "获取排片当页数据信息",
            description: "根据传入的当前页和每页显示条数获取当页的排片数据", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数
            parameters: [
                {
                    name: "curPage",
                    in: "query",    //get类型的参数在query中获取
                    schema: {
                        type: "integer",   //integer 整数
                        default: 1,
                    },
                    required: true,  //必填
                    description: "当前⻚码",
                },
                {
                    name: "eachPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "每⻚显示条数",
                },
            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/ArrayOfSchedulesRetuen",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/getMovie": {
        get: {
            tags: ["schedules"],
            summary: "获取所有电影信息",
            description: "获取所有电影信息", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数

            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/movieRetuen",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/getCinemas": {
        get: {
            tags: ["schedules"],
            summary: "获取所有影院信息",
            description: "获取所有影院信息", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemasRetuen",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/getTheaters/:_id": {
        get: {
            tags: ["schedules"],
            summary: "获取放映厅数据信息",
            description: "根据影院id获取对应的放映厅数据", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数
            parameters: [
                {
                    name: "_id",
                    in: "params",    //get类型的参数在query中获取
                    schema: {
                        type: "string",
                    },
                    required: true,  //必填
                    description: "影院id",
                },

            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/theaterRetuen",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/addSchedules": {
        post: {
            tags: ["schedules"], //属于哪一个功能模块
            summary: "新增排片",
            // 具体描述
            description: "这是一个新增排片功能，需传入排片相对应的参数",
            consumes: ["application/json"], //请求的数据类型 JSON
            requestBody: {    //请求参数
                required: true, //必填
                content: {  //内容(具体参数)
                    "application/json": {
                        schema: {//参数的结构
                            $ref: "#/components/schemas/addSchedules",
                        },
                        // example 例子
                        example: {
                            movieId: "asdsad",
                            cinemasId: "1asdsdas2",
                            theaterId: "adfadfd",
                            showTime: "2001-10-16 16:00",
                            price: "22",
                        },
                    },
                },
            },

            // 响应
            responses: {
                // http状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/addReturn",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/removeSchedules/:_id": {
        delete: {
            tags: ["schedules"], //属于哪一个功能模块
            summary: "删除排片",
            // 具体描述
            description: "这是一个删除排片功能，需传入排片相对应的_id",
            consumes: ["application/json"], //请求的数据类型 JSON
            parameters: [
                {
                    name: "_id",
                    in: "params",    //get类型的参数在query中获取
                    schema: {
                        type: "integer",   //integer 整数
                        default: 1,
                    },
                    required: true,  //必填
                    description: "当前⻚码",
                },
            ],

            // 响应
            responses: {
                // http状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/addReturn",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/getsortmoviesData/:_id": {
        get: {
            tags: ["schedules"],
            summary: "通过排片id找到整条数据",
            description: "通过排片id找到整条数据", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数
            parameters: [
                {
                    name: "_id",
                    in: "params",    //get类型的参数在query中获取
                    schema: {
                        type: "string",
                    },
                    required: true,  //必填
                    description: "排片id",
                },

            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/rowsReturn",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/addOrder": {
        post: {
            tags: ["schedules"], //属于哪一个功能模块
            summary: "新增订单",
            // 具体描述
            description: "这是一个新增订单功能，需传入订单模型相对应的参数",
            consumes: ["application/json"], //请求的数据类型 JSON
            requestBody: {    //请求参数
                required: true, //必填
                content: {  //内容(具体参数)
                    "application/json": {
                        parameters: [
                            {
                                name: "shopSeatId",
                                in: "body",    //get类型的参数在query中获取
                                schema: {
                                    type: "Array",
                                },
                                required: true,  //必填
                                description: "选座的ID",
                            },
                            {
                                name: "userId",
                                in: "body",    //get类型的参数在query中获取
                                schema: {
                                    type: "string",
                                },
                                required: true,  //必填
                                description: "用户的id",
                            },
                        ],
                    },
                },
            },
            // 响应
            responses: {
                // http状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/addReturn",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/findMovie/:_id": {
        get: {
            tags: ["schedules"],
            summary: "传入电影的id查找有哪些排片是这个电影",
            description: "传入电影的id查找有哪些排片是这个电影", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数
            parameters: [
                {
                    name: "_id",
                    in: "params",    //get类型的参数在query中获取
                    schema: {
                        type: "string",
                    },
                    required: true,  //必填
                    description: "电影id",
                },

            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/rowsReturn",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/schedules/getSeatings/:_id": {
        get: {
            tags: ["schedules"],
            summary: "传入排片id获取这场电影的座位状态",
            description: "传入排片id获取这场电影的选座座位状态", // 具体描述
            consumes: ["application/json"],
            // parameters 请求参数
            parameters: [
                {
                    name: "_id",
                    in: "params",    //get类型的参数在query中获取
                    schema: {
                        type: "string",
                    },
                    required: true,  //必填
                    description: "排片id",
                },

            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/getSeatingsReturn",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
}

module.exports = { tags, schemas, paths };